<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .bg-red {
      background-color: #f00;
    }

    .text-yellow {
      color: yellow;
    }
  </style>
</head>

<body>

  <div id="app">
    <!--     <div v-bind:style="style1">
      绑定一个data里面声明的对象
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa exercitationem veritatis perferendis vero minus
      esse dolorem modi quae officiis soluta.
    </div>
    <div v-bind:style="{color:'blue','width': '200px', 'height': '200px'}">
      绑定一个字面量的对象
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa exercitationem veritatis perferendis vero minus
      esse dolorem modi quae officiis soluta.
    </div> -->
    <div :class="{'bg-red':isBg,'text-yellow':isBg}">
      class绑定时，使用一个对象，如果值为真，就添加对象key名称为class标签属性绑定的值
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa exercitationem veritatis perferendis vero minus
      esse dolorem modi quae officiis soluta.
    </div>
    <br>
    <div :class="['bg-red','text-yellow']">
      ：class绑定一个数组，数组成员就是选择器名称。
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa exercitationem veritatis perferendis vero minus
      esse dolorem modi quae officiis soluta.
    </div>

    <div :class="[isBg?'bg-red':'','text-yellow']">
      ：class绑定一个数组，数组成员就是选择器名称。
      Lorem ipsum dolor sit amet consectetur adipisicing elit. Culpa exercitationem veritatis perferendis vero minus
      esse dolorem modi quae officiis soluta.
    </div>

  </div>

  <script src="./js/vue.js"></script>
  <script>
    let vm = new Vue({
      el: '#app',
      data: {
        isBg: false,
        style1: { 'color': 'red', 'width': '200px', 'height': '200px', 'border': '1px solid red' }
      }
    });


  </script>
</body>

</html>